package com.exhibition.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.exhibition.service.ITbExhUnitService;
import com.exhibition.util.Util;

@Controller
public class TbExhUnitController {
	
	@Autowired
	ITbExhUnitService tbExhUnitService;
	
	@RequestMapping("host/joinCountList.do")	
	public ModelAndView list(HttpServletRequest request,String ehi_id){
		ModelAndView mav=new ModelAndView("./exhinfo/inviteList.jsp");
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("ehi_id", ehi_id);
		mav.addObject("list", tbExhUnitService.getList(map));
		return mav;
	}
	
	@RequestMapping("unit/unitInviteList.do")	
	public ModelAndView unitInviteList(HttpServletRequest request,String ehi_name){
		ModelAndView mav=new ModelAndView("./unitinvite/list.jsp");
		//查询所有发出邀请函的单位
		Map<String,Object> invMap=new HashMap<String,Object>();
		invMap.put("unit_id", request.getSession().getAttribute("unit_id"));
		invMap.put("ehi_name", ehi_name);
		mav.addObject("list", tbExhUnitService.getList(invMap));
		mav.addObject("ehi_name", ehi_name);
		return mav;
	}
	@RequestMapping("unit/detailUnitInvite.do")	
	public ModelAndView detailUnitInvite(HttpServletRequest request,String id){
		ModelAndView mav=new ModelAndView("./unitinvite/detail.jsp");
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("id", id);
		mav.addObject("exhinfo", tbExhUnitService.getOne(map));
		return mav;
	}
}
